/*******************************************************************************
 * Copyright (c) 2009 IBM Corporation and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *     IBM Corporation - initial API and implementation
 *******************************************************************************/
package front.end.subestacao.tests;

import java.io.File;
import java.io.FileInputStream;

import front.end.subestacao.xml.reader.XmlFile;

/**
 * @author Katia Emmanuelle
 * 
 * Compara se dois arquivos tem conteudos iguais.
 *
 */
public class FileCompare {

	public static boolean saoIguais(File a, File b){
		boolean arquivosIguais = true;
		try {
			
			FileInputStream fileA = new FileInputStream(a);
			FileInputStream fileB = new FileInputStream(b);
			int intA = 0;
			int intB = 0;
			while(arquivosIguais && intA!= -1 && intB != -1){
				intA = fileA.read();
				intB = fileB.read();
				if(intA != intB){
					arquivosIguais = false;
				}
				
			}
		} catch (Exception e) {
			
			e.printStackTrace();
		}
		return arquivosIguais;
	}
		
}
